<template>
  <div>
    <div class="ele-body">
      <el-card shadow="never" body-style="padding: 15px 0 25px 0;">


        <el-row :gutter="20"  style="margin-bottom: 20px;">
          <el-col :md="24" :sm="12" :xs="24">
            <el-alert type="info" :closable="false" class="ele-alert-border">
              <div class="ele-cell">
                <div class="ele-cell-content">
                  <div class="ele-cell-title"> <h5 style="margin: 5px 0 15px 0">定期回收记录生成预约回收订单任务</h5> </div>
                  <div class="ele-cell-desc"> <h6 style="margin-bottom: 10px">{{host +'/mobile/index/reserveLogTimer'}} <el-link type="success" @click="copy_url(host +'/mobile/index/reserveLogTimer')">复制</el-link></h6> </div>
                </div>
              </div>
            </el-alert>
          </el-col>
        </el-row>



        <el-row :gutter="20"  style="margin-bottom: 20px;">
          <el-col :md="24" :sm="12" :xs="24">
            <el-alert type="info" :closable="false" class="ele-alert-border">
              <div class="ele-cell">
                <div class="ele-cell-content">
                  <div class="ele-cell-title"> <h5 style="margin: 5px 0 15px 0">兑换商城完成订单任务</h5> </div>
                  <div class="ele-cell-desc"> <h6 style="margin-bottom: 10px">{{host +'/mobile/index/goodsOrderTimer'}} <el-link type="success" @click="copy_url(host +'/mobile/index/goodsOrderTimer')">复制</el-link></h6> </div>
                </div>
              </div>
            </el-alert>
          </el-col>
        </el-row>

        <el-row :gutter="20"  style="margin-bottom: 20px;">
          <el-col :md="24" :sm="12" :xs="24">
            <el-alert type="info" :closable="false" class="ele-alert-border">
              <div class="ele-cell">
                <div class="ele-cell-content">
                  <div class="ele-cell-title"> <h5 style="margin: 5px 0 15px 0">积分商城完成订单任务</h5> </div>
                  <div class="ele-cell-desc"> <h6 style="margin-bottom: 10px">{{host +'/mobile/index/integralOrderTimer'}}  <el-link type="success" @click="copy_url(host +'/mobile/index/integralOrderTimer')">复制</el-link></h6></div>
                </div>
              </div>
            </el-alert>
          </el-col>
        </el-row>



      </el-card>
    </div>
  </div>
</template>

<script>
 
  export default {
    name: 'SysTimer',
    data() {
      return {
        host:window.location.protocol + "//" +location.host
      };
    },
    methods: {
      copy_url(content){
       // window.clipboardData.setData('text', context);

        if (window.clipboardData) {
            /*
            window.clipboardData有三个方法:
          （1）clearData(sDataFormat) 删除剪贴板中指定格式的数据。sDataFormat:"text","url"
          （2）getData(sDataFormat) 从剪贴板获取指定格式的数据。 sDataFormat:"text","url"
          （3）setData(sDataFormat, sData) 给剪贴板赋予指定格式的数据。返回 true 表示操作成功。
            */
          window.clipboardData.setData('text', content);
        } else {
          (function (content) {
            //oncopy 事件在用户拷贝元素上的内容时触发。
            document.oncopy = function (e) {
              e.clipboardData.setData('text', content);
              e.preventDefault(); //取消事件的默认动作
              document.oncopy = null;
            }
          })(content);
          //execCommand方法是执行一个对当前文档/当前选择/给出范围的命令。
          //'Copy':将当前选中区复制到剪贴板。 
          document.execCommand('Copy');
        }
        this.$message.success('复制成功！');
      },
    }
  };
</script>
